// 通用加密
export const encrypt = (text = '', start = 6, end = 4, star = 4) => {
  if (typeof text !== 'string' || !text) {
    return text
  }

  return text.slice(0, start).concat(Array(star + 1).join('*')).concat(text.slice(text.length - end))
}

// 身份证号码加密
export const encryptIdcard = (text = '') => encrypt(text)

// 手机号码加密
export const encryptPhone = (text = '') => encrypt(text, 3)

// 银行卡号加密
export const encryptBankcard = (text = '') => encrypt(text)
